<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "guide_field_data".
 *
 * @property string $gid
 * @property string $type The ID of the target entity.
 * @property string $langcode
 * @property string $title
 * @property string $subtitle
 * @property string $parent The ID of the target entity.
 * @property int $flag
 * @property string $body__value
 * @property string $body__summary
 * @property string $body__format
 * @property string $sound_body__target_id The ID of the file entity.
 * @property int $sound_body__display Flag to control whether this file should be displayed when viewing content.
 * @property string $sound_body__description A description of the file.
 * @property string $route_body__value
 * @property string $route_body__summary
 * @property string $route_body__format
 * @property string $picture__target_id The ID of the file entity.
 * @property string $picture__alt Alternative image text, for the image's 'alt' attribute.
 * @property string $picture__title Image title text, for the image's 'title' attribute.
 * @property string $picture__width The width of the image in pixels.
 * @property string $picture__height The height of the image in pixels.
 * @property string $list_picture__target_id The ID of the file entity.
 * @property string $list_picture__alt Alternative image text, for the image's 'alt' attribute.
 * @property string $list_picture__title Image title text, for the image's 'title' attribute.
 * @property string $list_picture__width The width of the image in pixels.
 * @property string $list_picture__height The height of the image in pixels.
 * @property int $promote
 * @property string $longitude
 * @property string $latitude
 * @property string $map_zoom
 * @property string $ground_overlay__target_id The ID of the file entity.
 * @property string $ground_overlay__alt Alternative image text, for the image's 'alt' attribute.
 * @property string $ground_overlay__title Image title text, for the image's 'title' attribute.
 * @property string $ground_overlay__width The width of the image in pixels.
 * @property string $ground_overlay__height The height of the image in pixels.
 * @property string $ground_overlay_east
 * @property string $ground_overlay_north
 * @property string $ground_overlay_west
 * @property string $ground_overlay_south
 * @property int $show_point
 * @property int $show_nav
 * @property int $show_label
 * @property string $uid The ID of the target entity.
 * @property int $status
 * @property int $created
 * @property int $changed
 * @property int $default_langcode
 * @property string $content_translation_source
 * @property int $content_translation_outdated
 * @property string $content_translation_uid The ID of the target entity.
 */
class GuideFieldData extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'guide_field_data';
    }

    public function getPrice()
    {
        return GuidePrice::findOne(['gid'=>$this->gid, 'langcode'=>$this->langcode]);
    }

    public function getParentGuide()
    {
        return $this->hasOne(__CLASS__, ['parent' => 'gid']);
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['gid', 'type', 'langcode', 'uid', 'status', 'default_langcode'], 'required'],
            [['gid', 'parent', 'flag', 'sound_body__target_id', 'sound_body__display', 'picture__target_id', 'picture__width', 'picture__height', 'list_picture__target_id', 'list_picture__width', 'list_picture__height', 'promote', 'map_zoom', 'ground_overlay__target_id', 'ground_overlay__width', 'ground_overlay__height', 'show_point', 'show_nav', 'show_label', 'uid', 'status', 'created', 'changed', 'default_langcode', 'content_translation_outdated', 'content_translation_uid'], 'integer'],
            [['body__value', 'body__summary', 'sound_body__description', 'route_body__value', 'route_body__summary'], 'string'],
            [['longitude', 'latitude', 'ground_overlay_east', 'ground_overlay_north', 'ground_overlay_west', 'ground_overlay_south'], 'number'],
            [['type'], 'string', 'max' => 32],
            [['langcode', 'content_translation_source'], 'string', 'max' => 12],
            [['title', 'subtitle', 'body__format', 'route_body__format'], 'string', 'max' => 255],
            [['picture__alt', 'list_picture__alt', 'ground_overlay__alt'], 'string', 'max' => 512],
            [['picture__title', 'list_picture__title', 'ground_overlay__title'], 'string', 'max' => 1024],
            [['gid', 'langcode'], 'unique', 'targetAttribute' => ['gid', 'langcode']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'gid' => Yii::t('app', 'Gid'),
            'type' => Yii::t('app', 'Type'),
            'langcode' => Yii::t('app', 'Langcode'),
            'title' => Yii::t('app', 'Title'),
            'subtitle' => Yii::t('app', 'Subtitle'),
            'parent' => Yii::t('app', 'Parent'),
            'flag' => Yii::t('app', 'Flag'),
            'body__value' => Yii::t('app', 'Body Value'),
            'body__summary' => Yii::t('app', 'Body Summary'),
            'body__format' => Yii::t('app', 'Body Format'),
            'sound_body__target_id' => Yii::t('app', 'Sound Body Target ID'),
            'sound_body__display' => Yii::t('app', 'Sound Body Display'),
            'sound_body__description' => Yii::t('app', 'Sound Body Description'),
            'route_body__value' => Yii::t('app', 'Route Body Value'),
            'route_body__summary' => Yii::t('app', 'Route Body Summary'),
            'route_body__format' => Yii::t('app', 'Route Body Format'),
            'picture__target_id' => Yii::t('app', 'Picture Target ID'),
            'picture__alt' => Yii::t('app', 'Picture Alt'),
            'picture__title' => Yii::t('app', 'Picture Title'),
            'picture__width' => Yii::t('app', 'Picture Width'),
            'picture__height' => Yii::t('app', 'Picture Height'),
            'list_picture__target_id' => Yii::t('app', 'List Picture Target ID'),
            'list_picture__alt' => Yii::t('app', 'List Picture Alt'),
            'list_picture__title' => Yii::t('app', 'List Picture Title'),
            'list_picture__width' => Yii::t('app', 'List Picture Width'),
            'list_picture__height' => Yii::t('app', 'List Picture Height'),
            'promote' => Yii::t('app', 'Promote'),
            'longitude' => Yii::t('app', 'Longitude'),
            'latitude' => Yii::t('app', 'Latitude'),
            'map_zoom' => Yii::t('app', 'Map Zoom'),
            'ground_overlay__target_id' => Yii::t('app', 'Ground Overlay Target ID'),
            'ground_overlay__alt' => Yii::t('app', 'Ground Overlay Alt'),
            'ground_overlay__title' => Yii::t('app', 'Ground Overlay Title'),
            'ground_overlay__width' => Yii::t('app', 'Ground Overlay Width'),
            'ground_overlay__height' => Yii::t('app', 'Ground Overlay Height'),
            'ground_overlay_east' => Yii::t('app', 'Ground Overlay East'),
            'ground_overlay_north' => Yii::t('app', 'Ground Overlay North'),
            'ground_overlay_west' => Yii::t('app', 'Ground Overlay West'),
            'ground_overlay_south' => Yii::t('app', 'Ground Overlay South'),
            'show_point' => Yii::t('app', 'Show Point'),
            'show_nav' => Yii::t('app', 'Show Nav'),
            'show_label' => Yii::t('app', 'Show Label'),
            'uid' => Yii::t('app', 'Uid'),
            'status' => Yii::t('app', 'Status'),
            'created' => Yii::t('app', 'Created'),
            'changed' => Yii::t('app', 'Changed'),
            'default_langcode' => Yii::t('app', 'Default Langcode'),
            'content_translation_source' => Yii::t('app', 'Content Translation Source'),
            'content_translation_outdated' => Yii::t('app', 'Content Translation Outdated'),
            'content_translation_uid' => Yii::t('app', 'Content Translation Uid'),
        ];
    }
}
